package com.smh.aiagent.config;

import com.alibaba.cloud.ai.dashscope.chat.DashScopeChatOptions;
import jakarta.annotation.Resource;
import org.springframework.ai.chat.prompt.ChatOptions;
import org.springframework.ai.model.tool.DefaultToolCallingChatOptions;
import org.springframework.ai.tool.ToolCallback;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author shiminghui
 * @date 2025/6/5 18:51
 * @description: TODO
 */
@Configuration
public class ChatOptionConfig {

    @Resource
    private ToolCallback[] allTools;

    @Bean
    public ChatOptions toolCallingChatOptions() {
        return DefaultToolCallingChatOptions
                .builder()
                .internalToolExecutionEnabled(true) // 是否允许内部工具执行,设置为false意味着我们需要自己解析工具调用,然后调用工具,并将结果返回给AI
                .build();


    }

    @Bean
    public ChatOptions dashscopeChatOptions() {
        return DashScopeChatOptions
                .builder()
                .build();
    }

}
